package org.code.mallspringboot.controller;

import org.code.mallspringboot.pojo.CmsSubject;
import org.code.mallspringboot.service.CmsSubjectService;
import org.code.mallspringboot.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/subject")
public class CmsSubjectController {

    @Autowired
    private CmsSubjectService cmsSubjectService;

    @GetMapping("/listAll")
    public CommonResult listAll(){
        List<CmsSubject> listAll = cmsSubjectService.listAll();
        if (listAll.size() > 0) {
            return CommonResult.success(listAll);
        }
        return CommonResult.failed("cms_subject查询失败");
    }
}
